/*
 * @Descripttion:
 * @version:
 * @Author: kl2018
 * @Date: 2019-03-07 20:06:15
 * @LastEditors: kl2018
 * @LastEditTime: 2020-08-18 16:20:09
 */

import { observer } from 'mobx-react';
import BaseListComponent from './common/BaseListComponent';
import SearchReqStore from '../stores/SearchReqStore';
import { hashHistory } from 'react-router';


@observer
/**
 * 公文流程查询
 */
class SearchReqComponent extends BaseListComponent {
  constructor(props) {
    super(props);
		/*
				query:
				isNew true 新的公文流程查询 false老的公文流程查询
				officalType 公文种类 1 发文 2 收文 3 签报 （isNew和officalType一起使用 是不会有tab页签）
		*/
    const locationQuery = {
      isNew: true,
      ...props.location.query,
    };
    const searchReqStore = new SearchReqStore(locationQuery);
    this.state = { listStore: searchReqStore };

    const { location } = props;
    const { officalType } = location.query;
    if (officalType && officalType == 1) {
      hashHistory.replace({
        pathname: '/main/offical/customPage',
        query: {
          customListId: -15,
          ...location.query,
        },
      });
      return;
    }
    if (officalType && officalType == 2) {
      hashHistory.replace({
        pathname: '/main/offical/customPage',
        query: {
          customListId: -19,
          ...location.query,
        },
      });
      return;
    }
    if (officalType && officalType == 3) {
      hashHistory.replace({
        pathname: '/main/offical/customPage',
        query: {
          customListId: -23,
          ...location.query,
        },
      });
      return;
    }
    hashHistory.replace({
      pathname: '/main/offical/customPage',
      query: {
        customListId: -11,
        ...location.query,
      },
    });
  }
}
export default props => <SearchReqComponent ecId={`${this && this.props && this.props.ecId || ''}_SearchReqComponent@bhijuu`} {...props} key={props.location.query.officalType || '0'} />;

